home *** CD-ROM | disk | FTP | other *** search
-
- /* setxtsty.c Turbo C Bible, page 858 */
- #include <graphics.h>
- main()
- {
- int graphdriver = DETECT, graphmode, xmax, ymax, xsize, ysize, x, y, c;
- void *i_buf;
- /* Detect and initialize graphics system */
- initgraph(&graphdriver, &graphmode, "c:\\turboc");
- /* Define a viewport */
- xmax = getmaxx();
- ymax = getmaxy();
- xsize = xmax - 100;
- ysize = ymax - 60;
- setviewport(50, 30, xsize+50, ysize+30, 1);
- setfillstyle(SOLID_FILL, RED);
- bar3d( 0, 0, xsize, ysize, 0, 1);
- /* Mark the center of the viewport and show how vertical
- * and horizontal text looks */
- x = xsize/2;
- y = ysize/2;
- setlinestyle(DASHED_LINE, 0,NORM_WIDTH);
- moveto(0,y);
- lineto(xsize,y);
- moveto(x,0);
- lineto(x,ysize);
- setcolor(YELLOW);
- /* Use (left, bottom) justification */
- settextjustify(LEFT_TEXT, BOTTOM_TEXT);
- settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 1);
- outtextxy(x,y,"H o r i z o n t a l");
- settextstyle(SANS_SERIF_FONT, VERT_DIR, 1);
- outtextxy(x,y,"V e r t i c a l");
- /* Print a message in default font */
- settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
- outtextsty(10,ysize-10,"Press any key to exit");
- getch();
- /* Close graphics system when done */
- closegraph();
- }